﻿CREATE TABLE [dbo].[PaidOrders] (
    [ID]             INT             IDENTITY (1, 1) NOT NULL,
    [OrderNo]        VARCHAR (255)   NOT NULL,
    [CustomerID]     INT             NOT NULL,
    [NoteDate]       DATETIME        NOT NULL,
    [OperatorUserID] INT             NOT NULL,
    [CreatedOn]      DATETIME        NOT NULL,
    [TotalMoney]     DECIMAL (10, 2) NOT NULL,
    [Method]         INT             NOT NULL,
    [Description]    VARCHAR (500)   NULL,
    [DealOrderList]  VARCHAR (MAX)   NOT NULL,
    [Balance]        DECIMAL (18, 5) CONSTRAINT [DF_PaidOrders_Balance] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK__order_pa__3214EC27276EDEB3] PRIMARY KEY CLUSTERED ([ID] ASC),
    CONSTRAINT [FK_order_paid_customers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[Customers] ([ID]),
    CONSTRAINT [FK_order_paid_users] FOREIGN KEY ([OperatorUserID]) REFERENCES [dbo].[Users] ([ID])
);

